package com.stottlerhenke.simbionic.api;

public class SB_Vector {

  public float x;
  public float y;
  public float z;

  public SB_Vector() {
  }

  public SB_Vector(float xx, float yy, float zz){
    x = xx;
    y = yy;
    z = zz;
  }
  public SB_Vector(SB_Vector vec) {
    x = (vec.x);
    y = (vec.y);
    z = (vec.z);
  }
  
  public boolean equals(Object o2)
  {
	  SB_Vector v2 = (SB_Vector) o2;
	  return (x == v2.x && y == v2.y && z == v2.z);
  }

  public SB_Vector opAdd(SB_Vector vec) {
     return new SB_Vector(x+vec.x,y+vec.y,z+vec.z);
  }

  public SB_Vector opSUB(SB_Vector vec) {
     return new SB_Vector(x-vec.x,y-vec.y,z-vec.z);
   }

  public SB_Vector opMUL(float scal) {
     return new SB_Vector(x*scal,y*scal,z*scal);
   }

  public SB_Vector opDIV(float scal) {
     return new SB_Vector(x/scal,y/scal,z/scal);
   }

  public float Length() {
      return (float) Math.sqrt(x*x + y*y + z*z);
    }
  
  public String toString() {
	  return "[" + x + "," + y + "," + z + "]";
  }

}